package com.greenline.push.core.pushcenter.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;

import com.greenline.push.core.pushcenter.GroupUserManager;
import com.greenline.push.dal.pushcenter.GroupUserDao;
import com.greenline.push.dal.pushcenter.dataobject.GroupUserDO;
import com.greenline.push.dal.query.GroupUserQuery;

/**
 * 
 * @Type GroupAppManagerImpl
 * @Desc GroupAppManagerImpl crud
 * @author shuai.zuo
 * @date 2014年10月10日
 * @Version V1.0
 */
public class GroupUserManagerImpl implements GroupUserManager {
    @Autowired
    private GroupUserDao groupUserDao;

    @Override
    public Long insert(GroupUserDO groupUserDO) {
        return groupUserDao.insert(groupUserDO);
    }

    @Override
    public boolean update(GroupUserDO groupUserDO) {
        if (null == groupUserDO) {
            return false;
        }
        return groupUserDao.update(groupUserDO) > 0;
    }

    @Override
    public GroupUserQuery listByQuery(GroupUserQuery query) {
        return groupUserDao.listByQuery(query);
    }

    @Override
    public GroupUserDO getById(Long id) {
        return groupUserDao.getById(id);
    }

    @Override
    public boolean delete(Long id) {
        if (null == id) {
            return false;
        }
        return groupUserDao.deleteById(id) > 0;
    }

    @Override
    public boolean delete(Long gid, Long uid) {
        return groupUserDao.delete(gid, uid) > 0;
    }

    @Override
    public List<GroupUserDO> queryByGid(Long gid) {
        return groupUserDao.queryByGid(gid);
    }

}
